package com.bstek.u;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;

import com.bstek.uflo.console.UfloServlet;

@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@ComponentScan(basePackages = { "com.bstek.u","com.colaui" })
@ImportResource(locations = { "classpath:spring-context.xml"})
public class UApplication {

	public static void main(String[] args) {
		SpringApplication.run(UApplication.class, args);
	}

	@Bean
	public ServletRegistrationBean buildUfloServlet() {
		ServletRegistrationBean registration = new ServletRegistrationBean(new UfloServlet());
		registration.getUrlMappings().clear();
		registration.addUrlMappings("/uflo/*");
		return registration;
	}

//	@Bean
//	public ServletRegistrationBean buildURuleServlet() {
//		ServletRegistrationBean registration = new ServletRegistrationBean(new URuleServlet());
//		registration.getUrlMappings().clear();
//		registration.addUrlMappings("/urule/*");
//		return registration;
//	}

//	@Bean
//	public FilterRegistrationBean buildTestFilter() {
//		FilterRegistrationBean bean = new FilterRegistrationBean();
//		bean.setFilter(new UFilter());
//		bean.addUrlPatterns("/*");
//		return bean;
//	}

}